package com.zhkj.shixi.tvplayer.MusicPlayer;

import android.app.Activity;
import android.database.Cursor;
import android.provider.MediaStore;

import java.util.ArrayList;
import java.util.List;

/**
 * Created by suqiuyu on 19-8-19.
 */

public class PlayerBackGround {
    Activity mActivity;
    List<Pic> picList;

    public PlayerBackGround(Activity activity) {
        mActivity = activity;
        picList = new ArrayList<Pic>();
    }

    public void initList() {
        Cursor cursor = mActivity.getContentResolver().query(
                MediaStore.Images.Media.EXTERNAL_CONTENT_URI, null, null, null, null);
        if (cursor != null) {
            while (cursor.moveToNext()) {
                String name = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DISPLAY_NAME));
                String data = cursor.getString(cursor.getColumnIndex(MediaStore.Images.Media.DATA));
                Pic pic = new Pic();
                pic.name = name;
                pic.path = data;
                picList.add(pic);
            }
        }

    }

    public List<Pic> getPicList() {
        return picList;
    }

    public class Pic {
        public String name;
        public String path;
    }
}


